

# 项目信息
project (DemoM1)

# aux_source_directory(. srcs)

add_library(a OBJECT a.c)
add_library(b OBJECT b.c)

# message(STATUS ${srcs})

set(ofile ${CMAKE_BINARY_DIR})
add_custom_command(
	OUTPUT c.o
	COMMAND find -type f -name "*.o"
	COMMAND cp $<TARGET_OBJECTS:b> ${ofile}/c.o
	# COMMAND echo $<TARGET_OBJECTS:obja>|tee xx.a
	DEPENDS b
	)
# add_custom_target(c ALL DEPENDS c.o)
# add_custom_target( ALL DEPENDS c.a)

add_library(obj $<TARGET_OBJECTS:a>)
set_property(TARGET obj PROPERTY EXTERNAL_OBJECT true)
# add_custom_target(obj ALL DEPENDS c.a)
# add_custom_command(
# 	TARGET obj
# 	COMMAND find -type f -name "*.o"
# 	)

target_link_libraries(obj ${ofile}/c.o)
# add_dependencies(obj c)

# add_custom_target(aa DEPENDS obja xx.a)
# add_executable(m1 ${srcs})
# install(TARGETS obj DESTINATION obj)
# install(FILES xx.a DESTINATION lib)
# 指定生成目标
# add_executable(Demo main.cc)
# add_library(xx SHARED main.cc)
# add_library(lxx SHARED main.cc)
